import React, { Component } from 'react';
import {Link} from 'react-router-dom';
class Public extends Component {
    constructor(props) {
        super(props);
        this.state = {  };
    }
    render() {
        if(this.props.location.state){
            console.log(this.props.location.state.id)
        }
        return (
            <>
            <Link to={{pathname:'/',
            search:'?to=public'
        }}>
            <h2>public到首页</h2>
            </Link>
            <div>
                <h1>Public页面</h1>
                <hr/>
                <Link to="/public/1">
                    <button>第一个页面</button>
                </Link>
                <hr/>
                <Link to="/public/2">
                    <button>第二个页面</button>
                </Link>
                <hr/>
                <Link to="/public/3">
                    <button>第三个页面</button>
                </Link>
            </div>
            </>
        );
    }
}

export default Public;